<template>
  <div class="learn-card" >
    <el-tabs v-model="activeName" @tab-click="cleanDetail">
      <el-tab-pane label="学习卡管理" name="1">
        <card v-if="activeName === '1'" @singleUsedCard="getUsedCard"/>
      </el-tab-pane>
      <el-tab-pane label="使用查询" name="2">
        <used-card v-if="activeName === '2'" :single-used-card="usedCardDetail"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
import Card from './components/learncard/card'
import UsedCard from './components/learncard/usedcard'
export default {
  components: {
    Card,
    UsedCard
  },
  data() {
    return {
      activeName: '1',
      usedCardDetail: []
    }
  },
  methods: {
    getUsedCard(detailList) {
      this.usedCardDetail = detailList
      this.activeName = '2'
    },
    cleanDetail() {
      this.usedCardDetail = []
    }
  }
}
</script>

<style lang="scss" scoped>
.learn-card {
  padding: 0px 20px;
  .addprogram {
    width: 100%;
    padding: 20px 0;
    .el-button {
      float: right;
    }
  }
}
</style>
